<script setup lang="ts">
import Versions from './components/Versions.vue'
import Update from './components/Update.vue'
window.electron.ipcRenderer.on('data', (_, obj) => {
  console.log(3131)
  //这里是接受的消息,处理完成后将html片段放在body里面完成后就可以开始打印了
  //样式可以写在style里,也可以内联
  console.log('event, data: ', obj)
  //这里自由发挥
  document.body.innerHTML = `<style>
        .red{
            color: red;
        }
    </style>
    <div class="red">fasdfasd</div>`
  //通知主进程开始打印
  window.electron.ipcRenderer.send('startPrint')
})
window.electron.ipcRenderer.on('printStatus', (_, obj) => {
  console.log(obj)
})
const startPrint = () => {
  //通知主进程开始打印
  window.electron.ipcRenderer.send('handlePrint', {})
}

// const ipcHandle = () => window.electron.ipcRenderer.send('ping')
</script>

<template>
  <button @click="startPrint">开始打印fas</button>
  <Update />
  <Versions />
</template>
